//
// CrackUpdater
//
// Copyright (C) jextra.net.
//
//  This file is part of the Crack build system.
//
//  The Crack build system is free software; you can redistribute it 
//  and/or modify it under the terms of the GNU Lesser General Public
//  License as published by the Free Software Foundation; either
//  version 2.1 of the License, or (at your option) any later version.
//
//  The Crack build system is distributed in the hope that it will be 
//  useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
//  Lesser General Public License for more details.
//
//  You should have received a copy of the GNU Lesser General Public
//  License along with the Crack build system; if not, write to the Free
//  Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
//  02111-1307 USA.
//

package net.jextra.crack.updater;

import java.io.*;
import java.net.*;
import java.util.*;

public interface CrackUpdater
{
    /**
     * General purpose means to initialize a CrackUpdater. The params is most likely specified in
     * an XML file.
     */
    void init( CrackUpdaterParams params )
        throws Exception;

    /**
     * This should be a name that uniquely defines a updater which will be different than another
     * updater that does not "point" to the same place.
     */
    String getName()
        throws Exception;

    /**
     * Root URL of the updater. This is the URL that all other paths stem from.
     */
    URL getRootURL()
        throws Exception;

    /**
     * This is the amount of time to attempt to access the updater (In milliseconds).
     */
    int getTimeout()
        throws Exception;

    /**
     * Get list of {@link CrackUpdaterEntry}'s (files and sub-dirs) within a given path.
     */
    List<CrackUpdaterEntry> getEntries( String path )
        throws Exception;

    /**
     * Get a single entry from the updater.
     */
    CrackUpdaterEntry getEntry( String path )
        throws Exception;

    /**
     * Get a URL that points to the given file.
     */
    public URL getFileURL( String path )
        throws Exception;
    
    /**
     * Upload a given file to the updater's library.
     */
    public void uploadFile( String path, File localFile )
    	throws Exception;
}

